package cn.szabadsag.user.controller;

import cn.szabadsag.user.service.IWxUserService;
import cn.szabadsag.utils.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 微信用户扫码登录接口
 *
 * @author yangcong
 * @date 2022年03月13日 12:54
 * @since v1.0
 */
@RestController
@RequestMapping("/wxUser")
public class WxUserController {

    @Autowired
    private IWxUserService wxUserService;


    /**
     * 微信登录
     * @param map
     * @return
     */
    @PostMapping("/wxLogin")
    public AjaxResult wxLogin(@RequestBody Map<String,String> map){
        //  map.sout
        System.out.println(map);
        //  微信登录
        return wxUserService.wxLogin(map);
    }

    /**
     * 微信新用户接口
     * @param map
     * @return
     */
    @PostMapping("/bind")
    public AjaxResult bind(@RequestBody Map<String,String> map){
        //  map.sout
        System.out.println(map);
        //  新用户绑定
        return wxUserService.bind(map);
    }

}
